import 'package:get/get.dart';
import 'package:signage/app/routes/app_pages.dart';
import 'package:signage/app/utils/sp_util.dart';

class SplashController extends GetxController {
  //TODO: Implement SplashController

  final count = 0.obs;
  @override
  void onInit() {
    super.onInit();
  }

  @override
  void onReady() {
    super.onReady();

    Future.delayed(const Duration(seconds: 1), () {
      if (SpUtil.getString('token') != null) {
        Get.offNamed(Routes.HOME);
      } else {
        Get.offNamed(Routes.LOGIN);
      }
    });
  }

  @override
  void onClose() {
    super.onClose();
  }

  void increment() => count.value++;
}
